package com.lj.infoisland.common.enums;

/*
 * @description 新闻状态枚举
 * @author 龙洁
 * @create 2024-12-25 上午9:57
 */
public enum NewStatus {

    // 0: 待审核 1: 审核通过 2: 审核不通过
    PENDING_REVIEW(0, "待审核"),
    REVIEW_PASS(1, "审核通过"),
    REVIEW_FAIL(2, "审核不通过");

    private final Integer code;
    private final String description;

    NewStatus(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据code获取description
     *
     * @param code code
     * @return description
     */
    public static String code2Description(Integer code) {
        for (NewStatus newStatus : NewStatus.values()) {
            if (newStatus.getCode().equals(code)) {
                return newStatus.getDescription();
            }
        }
        return null;
    }
}

